package com.winner.mongodb.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotEmpty;
import java.util.Date;

@Data
@Document(collection = "user")
public class User {

    @Id
    private String id;

    @NotEmpty(message = "name can not be empty")
    private String name;

    private Integer age;

    /** 2021-11-27 03:00:02:002 */
    @JsonFormat( pattern="yyyy-MM-dd HH:mm:ss:SSS")
    private Date createTime;

}
